home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / zendisk1.zip / LST7-1.ASM < prev    next >
Assembly Source File  |  1990-02-15  |  472b  |  20 lines

  1. ;
  2. ; *** Listing 7-1 ***
  3. ;
  4. ; Calculates the 16-bit sum of all bytes in a 64Kb block.
  5. ;
  6. ; Time with LZTIME.BAT, since this takes more than
  7. ; 54 ms to run.
  8. ;
  9.     call    ZTimerOn
  10.     sub    bx,bx    ;we'll just sum the data segment
  11.     sub    cx,cx    ;count 64K bytes
  12.     mov    ax,cx    ;set initial sum to 0
  13.     mov    dh,ah    ;set DH to 0 for summing later
  14. SumLoop:
  15.     mov    dl,[bx]    ;get this byte
  16.     add    ax,dx    ;add the byte to the sum
  17.     inc    bx    ;point to the next byte
  18.     loop    SumLoop
  19.     call    ZTimerOff
  20.